Skip to content

feat(workflows): add sample 'execute_with_arguments' and update 'conftest.py' #13290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

eapl-gemugami
Copy link
Contributor

@eapl-gemugami eapl-gemugami commented Apr 4, 2025

Description

Fixes b/391200147

  • Update the Workflow YAML definition to receive optional arguments, and keep compatibility with the previous sample not sending arguments. The Copyright year was adjusted accordingly as it's a new file with the same name.
  • Create a sample workflows_execute_with_arguments and start migration of workflows_execute_without_arguments
  • Refactor previous tests and conftest.py
  • Update README.py

Checklist

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @eapl-gemugami, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request introduces a new sample, workflows_api_quickstart_pass_data_in_execution_request, which demonstrates how to pass arguments to a Cloud Workflow execution. It also updates the Workflow YAML definition to accept optional arguments while maintaining compatibility with previous samples. Additionally, the PR refactors existing tests and the conftest.py file to accommodate the new functionality.

Highlights

  • Feature: Introduces a new sample, pass_data_in_execution_request.py, showcasing how to pass data to a workflow execution via an argument.
  • Enhancement: Updates the Workflow YAML definition (myFirstWorkflow.workflows.yaml) to accept optional arguments, ensuring backward compatibility.
  • Refactor: Refactors existing tests and conftest.py to support the new sample and argument passing functionality.

Changelog

Click here to see the changelog
  • workflows/cloud-client/README.md
    • Updates the README to reflect the correct location of the workflow YAML file and adjusts the expected output description.
    • Changes the compatible Python version to 3.9+.
  • workflows/cloud-client/conftest.py
    • Modifies workflow_id fixture scope to function to ensure unique workflow IDs for each test.
    • Updates the workflow creation logic to use a base workflow ID and append a UUID for uniqueness.
    • Updates workflow_exists function to accept a workflow_id parameter.
  • workflows/cloud-client/main_test.py
    • Changes max_time to max_tries in the backoff decorator for the test_workflow_execution function.
  • workflows/cloud-client/myFirstWorkflow.workflows.yaml
    • Updates the copyright year to 2025.
    • Modifies the workflow definition to accept an optional searchTerm argument, defaulting to the day of the week in Amsterdam if not provided.
  • workflows/cloud-client/pass_data_in_execution_request.py
    • Adds a new file containing the execute_workflow_with_argument function, which demonstrates how to pass arguments to a workflow execution.
  • workflows/cloud-client/pass_data_in_execution_request_test.py
    • Adds a new test file for the execute_workflow_with_argument function, verifying the successful execution and argument passing.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A workflow's gentle stream,
Data flows, a waking dream,
Arguments passed on,
Execution begun,
A digital paradigm.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: workflows Issues related to the Workflows API. labels Apr 4, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new sample for passing data in execution requests, updates the workflow YAML definition, and refactors existing tests. The changes look good overall, but there are a few areas that could be improved for clarity and maintainability.

Summary of Findings

  • Workflow ID Generation: The workflow ID generation in conftest.py could be simplified by directly incorporating the base name into the UUID string, improving readability.
  • README Update: The README update includes a change to the expected output, which is good. However, it could be more explicit about the dependency on the weekday in Amsterdam.
  • Copyright Year: The copyright year in myFirstWorkflow.workflows.yaml and pass_data_in_execution_request.py has been updated to 2025. Ensure this is the correct and intended year.

Merge Readiness

The pull request is almost ready for merging. Please address the comments regarding workflow ID generation and copyright year. I am unable to directly approve the pull request, and other reviewers should review and approve this code before merging.

@eapl-gemugami eapl-gemugami changed the title Paradalicea/feat/workflows/create sample/execution pass data/b 391200147 feat(workflow): add sample 'pass_data...' and update 'conftest.py' Apr 4, 2025
@eapl-gemugami eapl-gemugami added the snippet-bot:force-run Force snippet-bot runs its logic label Apr 4, 2025
@snippet-bot snippet-bot bot removed the snippet-bot:force-run Force snippet-bot runs its logic label Apr 4, 2025
Copy link

snippet-bot bot commented Apr 4, 2025

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@eapl-gemugami eapl-gemugami marked this pull request as ready for review April 4, 2025 17:15
@eapl-gemugami eapl-gemugami requested review from a team as code owners April 4, 2025 17:15
@eapl-gemugami eapl-gemugami changed the title feat(workflow): add sample 'pass_data...' and update 'conftest.py' feat(workflows): add sample 'pass_data...' and update 'conftest.py' Apr 4, 2025
@eapl-gemugami eapl-gemugami requested a review from OremGLG April 22, 2025 19:01
@OremGLG
Copy link
Contributor

OremGLG commented Apr 22, 2025

LGTM!

@eapl-gemugami eapl-gemugami changed the title feat(workflows): add sample 'pass_data...' and update 'conftest.py' feat(workflows): add sample 'execute_with_arguments.' and update 'conftest.py' Apr 22, 2025
@eapl-gemugami eapl-gemugami changed the title feat(workflows): add sample 'execute_with_arguments.' and update 'conftest.py' feat(workflows): add sample 'execute_with_arguments' and update 'conftest.py' Apr 22, 2025
@iennae iennae requested a review from camiekim April 22, 2025 20:00
@camiekim
Copy link
Contributor

LGTM! Just a couple of nits in the readme file

@eapl-gemugami eapl-gemugami requested a review from camiekim April 23, 2025 15:46
Copy link
Contributor

@camiekim camiekim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I missed this in my earlier review. Pls replace "Google Cloud Platform" with just "Google Cloud" in the readme file per https://cloud.google.com/guides/style/branding-list#cloud-name-list.

@eapl-gemugami
Copy link
Contributor Author

cc @OremGLG @hivanalejandro @alarconesparza this brand guideline that 'camiekim' mentioned could be useful for your samples.

@eapl-gemugami eapl-gemugami requested a review from camiekim April 24, 2025 14:21
Copy link
Contributor

@camiekim camiekim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks

@eapl-gemugami eapl-gemugami added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 24, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 24, 2025
@eapl-gemugami eapl-gemugami requested a review from iennae April 25, 2025 15:50
@glasnt glasnt merged commit e065437 into GoogleCloudPlatform:main Apr 28, 2025
11 checks passed
@eapl-gemugami eapl-gemugami deleted the paradalicea/feat/workflows/create-sample/execution-pass-data/b-391200147 branch April 28, 2025 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: workflows Issues related to the Workflows API. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants